package bishi;

import java.util.Arrays;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2021/09/27 23:39
 */
public class Test {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Test().leftRotate(new int[]{1,2,3,4,5},3)));
    }
    public int[] leftRotate (int[] nums, int k) {
        int len = nums.length;
        int[] res = new int[len];
        for(int i=k,j=0;i<len;i++,j++){
            res[j] = nums[i];
        }
        for(int i=0,j=len-k;i<k;i++,j++){
            res[j] = nums[i];
        }
        return res;
    }
}
